package com.cn.JUC.utils.case6;

/**
 * @Title CountDownLatch应用
 * @Description 对账案例--两个线程分别查询未对账单与派送单，查询完以后，进行对账，保存差异信息到数据库。
 * @Author CAI ZHAI
 * @Date 2021/9/3 16:19
 **/
/*public class VerifyAccountingRecord{
    
    // 创建2个线程的线程池
    Executor executor = Executors.newFixedThreadPool(2);
    while(存在未对账订单){
        // 计数器初始化为2
        CountDownLatch latch = new CountDownLatch(2);
        // 查询未对账订单
        executor.execute(()-> {
            pos = getPOrders();
            latch.countDown();
        });
        // 查询派送单
        executor.execute(()-> {
            dos = getDOrders();
            latch.countDown();
        });
        
        // 等待两个查询操作结束
        latch.await();
        
        // 执行对账操作
        diff = check(pos, dos);
        // 差异写入差异库
        save(diff);
    }
}*/
